<?php

namespace app\index\controller;

use think\worker\Server;
use Channel\Server as Channel_Server;
use Channel\Client;

class Worker1 extends Server
{
    protected $socket = 'websocket://0.0.0.0:8000';
    protected $option = ['name => worker1'];

    public function onWorkerSart($worker)
    {
        echo '启动进程';
        Client::connect('127.0.0.1',2206);
    }


    public function onConnect($connection)
    {
        $connection->send('receive success');
    }

    public function onMessage($connection,$data)
    {
        dump($data);
    }
}